import { find } from "lodash";

export const getTableColumns = ({ params }) => [
	{
		title: "名称",
		dataIndex: "label",
		width: 140,
		ellipsis: true
	},
	{
		title: "值",
		dataIndex: "value",
		width: 140,
		ellipsis: true
	},
	{
		title: "code",
		dataIndex: "code",
		width: 140,
		ellipsis: true
	},
	{
		title: "字典状态",
		dataIndex: "status",
		width: 140,
		ellipsis: true,
		render: (_: any, record: any) => {
			const result = find(COMMON_STATUS || [], (item: any) => item.value === record.status)
			return (
				<span>
					{result?.label}
				</span>
			)
		}
	},
	{
		title: "创建日期",
		dataIndex: "createTime",
		width: 140,
		ellipsis: true
	},
];


export const COMMON_STATUS = [
	{ label: '停用', value: 0 },
	{ label: '正常', value: 1 }
]
